1. Field of the Invention
The present invention relates to a method for frequency detection and detecting variation of frequency, and more particularly to a method for frequency detection and detecting variation of frequency for an electromagnetic position detection apparatus.
2. Description of Related Art
Electromagnetic position detection apparatus such as a digitizer or a digital tablet includes a detection area comprising a plurality of partially overlapped and parallel arranged along x and y axes antennas or sensor coils on a board or a substrate to receive and detect electromagnetic signals from a pointer such as an electromagnetic pen or a stylus. The antennas or sensor coils in the detection area around the location of the electromagnetic pen or the stylus receive and detect the electromagnetic signals from the electromagnetic pen or the stylus, and the electromagnetic position detection apparatus calculates the coordinates of the electromagnetic pen or the stylus according data including the frequency, amplification, and phase angle of the electromagnetic signals.
The electromagnetic signal detected by the antenna or sensor coil presents as an alternating voltage signal, and is processed by the electromagnetic position detection apparatus through signal amplification, phase detecting and signal conversion from analog to digital, etc. In order to calculate the coordinate of the electromagnetic pen or the stylus via the electromagnetic signal detected by the antenna or sensor coil, the frequency of the electromagnetic signal must be calculated. One of the conventional methods for calculating the frequency of the electromagnetic signal includes sampling the signal in a predetermined number of period/cycle and calculating the period/cycle of the signal by a timer and then converting the period/cycle to the frequency of the signal. However, using the timer to calculate the period/cycle and convert the period/cycle to the frequency has the following drawbacks. The clock speed of the timer must be high enough if the frequency is high or the tiny variation of the frequency will not be detected. Moreover, the number of the period/cycle selected to sample the signal must be large enough, but there will not be enough number of the period/cycle to be selected if the strength of the signal fades particularly when a batteryless electromagnetic pen or stylus is used. FIG. 1 shows a schematic diagram of a conventional method for calculating the variation of frequency of the signals. As shown in FIG. 1, the method includes the step of sampling two different numbers of cycles (2 cycles and 5 cycles) corresponding to two signals with slightly different frequencies respectively and subtracting the common error (such as the time or duration from the beginning shown in FIG. 1). The time of two cycles (time A) is subtracted from the time (time B) of five cycles corresponding to two signals with slightly different frequencies respectively, and the difference between time B and time A is divided by three (the difference between the numbers of cycles) and is very close to the current/present period of the signal. Thus the current/present frequency can be calculated. The feature of this method is that the calculation of the current/present frequency will not be significantly affected when the frequency varies. However, if the value of the variation of frequency is tiny which means that the value of the variation of period is also small, a timer with a very high clock speed must be used for calculating such tiny variation of frequency. For example, if the frequency varies from 375 KHz to 372 KHz, which means that the period varies from 2.666 μsec to 2.688 μsec, the value of the variation of period is only 0.022 μsec which needs a timer with a very high clock speed to calculate. The use of a timer with a very high clock speed will increase the cost. Another conventional method for calculating the variation of frequency of the signal includes the step of comparing phase shift of the signals. However, the phase shift of the signals depends on the hardware used, and large errors may be generated so that only relative difference between frequencies is obtained, not the actual frequency. Furthermore, the error will vary with the strength of the signal which further decreases the accuracy of the calculation of the frequency.
In order to precisely calculate the frequency and the variation of frequency of signal and to solve the above-mentioned drawbacks of the conventional method, the invention provides to a method for frequency detection and detecting variation of frequency for an electromagnetic position detection apparatus to calculate the actual frequency of signal within a shorter/smaller numbers of period/cycle without errors of the calculation of frequency resulting from the hardware used.